#include "app.h"
#include "BUTTON/mbutton.h"
#include "MultiButton/multi_button.h"

QueueHandle_t xButtonDataQueue = NULL;  // 队列句柄

void key1_single_click_handler(void* btn);

// 按键事件初始化
static void button_event_init(void)
{
    // 注册按键事件
    button_attach(&button1, SINGLE_CLICK, key1_single_click_handler);
}

void button_task(void *arg){
    
    button_event_init();
    
    while(1)
    {
        button_ticks(); 
        vTaskDelay(5); 
    }

}


void key1_single_click_handler(void* btn)
{
    mbutton_data_t mbutton_data;
    mbutton_data.id = KEY1;
    mbutton_data.event = SINGLE_CLICK;
    if (xQueueSend(xButtonDataQueue, &mbutton_data, pdMS_TO_TICKS(10)) != pdTRUE) {
        log_err("queue full! \n");
        return;
    }
		log_info("button1 sc\n");
}






